class Solution:
    def titleToNumber(self, s: str) -> int:
        n = 0
        for i in range(len(s)):
            n = n * 26
            n = n + ord(s[i]) - 64
        return n


if __name__ == '__main__':
    so = Solution()
    s = 'ZY'
    r = so.titleToNumber(s)
    print(r)
